#include"SeqList.h"

void SeqListDestory(SeqList* psl)
{
	assert(psl);

	free(psl->data);
	psl->data = NULL;
	psl->size = psl->capacity = 0;
}

void Check_capacity(SeqList* psl)
{
	assert(psl);

	if (psl->size == psl->capacity)
	{
		int tmp = (psl->capacity == 0 ? 4 : 2 * psl->capacity);
		SeqList* new = (SeqList*)realloc(psl->data, tmp * sizeof(psl));
		if (new == NULL)
		{
			perror(realloc);
			exit(-1);
		}
		psl->data = new;
		psl->capacity = tmp;
	}
}